﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MW.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (this.txtSearch.Text.Trim().Length > 0)
            {
                if (this.ddlColumn.Style["display"] == "none")
                {
                    Response.Redirect("Result.aspx?q=" + Server.HtmlEncode(this.txtSearch.Text.Trim()));
                }
                else
                {
                    Response.Redirect("Result.aspx?c=" + this.ddlColumn.SelectedItem.Value + "&q=" + Server.HtmlEncode(this.txtSearch.Text.Trim()));
                }
            }
        }

        protected void lnkSwitch_Click(object sender, EventArgs e)
        {
            if (this.ddlColumn.Style["display"] == "none")
            {
                this.ddlColumn.Style["display"] = "";
                this.lnkSwitch.Text = "一般搜索";
            }
            else
            {
                this.ddlColumn.Style["display"] = "none";
                this.lnkSwitch.Text = "字段搜索";
            }
        }
    }
}
